package abd.pr1.Controllers;
import javax.sql.DataSource;

import abd.pr1.Interface.MainWindow;
import abd.pr1.Models.Usuario;

public class MainWindowController {
	
	private MainWindow mainWindow;
	private DataSource ds;
	private Usuario user;
	
	private UserPanelController userPanelController;
	private BuscarSeriesPanelController buscarSeriesPanelController;
	private MisSeriesPanelController misSeriesPanelController;
	
	public MainWindowController(MainWindow mainWindow,DataSource ds, Usuario user){
		this.mainWindow=mainWindow;
		this.ds=ds;
		
		userPanelController = new UserPanelController(this, mainWindow.userPanel, ds, user);
		buscarSeriesPanelController = new BuscarSeriesPanelController(this, mainWindow.buscarSeriesPanel, ds, user);
		misSeriesPanelController = new MisSeriesPanelController(this, mainWindow.misSeriesPanel,ds, user);
		
		this.mainWindow.setUserPanelActionListener(userPanelController);
		this.mainWindow.setBuscarSeriesActionListener(buscarSeriesPanelController);
		this.mainWindow.setMisSeriesActionListener(misSeriesPanelController);
	}
	
	public void refreshUserPanelController(){
		this.userPanelController.refreshUserData();
	}
	
	public void refreshBuscarSeriesPanelController(){
		//this.buscarSeriesPanelController.refresh();
	}
	
	public void refreshMisSeriesPanelController(){
		this.misSeriesPanelController.refreshSeries();
	}
	

}
